﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ImportProjectFrm.aspx.vb" Inherits="ImportProjectFrm" MasterPageFile="~/MasterPage.master" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<%@ Register Assembly="ISNet.WebUI.WebCombo" Namespace="ISNet.WebUI.WebCombo" TagPrefix="ISWebCombo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <link href="script/style.css" rel="stylesheet" />
    <script src="script/tinybox.js"></script>
    <script>
        function popupwait() {
                TINY.box.show({ iframe: 'loading.html', boxid: 'frameless', close: 0, width: 300, height: 260, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { closeJS() } });
                var importbtn = document.getElementById("<%= btnImportAll.ClientID%>");
                importbtn.style.display = "none";
        }
        function popupwaitDelete() {
            var version = document.getElementById("<%= txtVersion.ClientID%>").value;
            if (version != '1' && version != '2' && version != '3' && version != '4' && version != '5') {
                TINY.box.show({ iframe: 'loading.html', boxid: 'frameless', close: 0, width: 300, height: 260, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { closeJS() } });
                var importbtn = document.getElementById("<%= btnImportAll.ClientID%>");
                importbtn.style.display = "none";
            }
            else
                alert('ต้องระบุ version 5 ขึ้นไป กรุณาระบุ version ใหม่');
        }
        function CustomRequestDel() {
            if (confirm('กรุณายืนยันการลบข้อมูล') == false) {
                return false
            }
            var grid = ISGetObject("WebGrid1");
            var table = grid.GetRootTable();
            var checkedRows = table.GetCheckedRows();
            if (checkedRows.length == 0) {
                alert("Please check an item.");
                setTimeout(function () { grid.SetFocus(); }, 10);
            }
            else {
                grid.AddInput("type", "2");
                grid.SendCustomRequest();
            }
            event.cancelBubble = true;
            event.returnValue = false;
        }
        function DisableCheck() {
            try {
                var rowcount = WebGrid_GetTotalRowCount();
                var WebGrid1 = ISGetObject("WebGrid1");
                var rowCheckerElm = WebGrid1.RootTable.GetElement(WG40.COLHEADER, WG40.HTMLTABLE).cells[1].childNodes[0].childNodes[0].childNodes[0];
                if (rowcount == 0) {
                    rowCheckerElm.checked = false;
                    rowCheckerElm.disabled = true;
                    return true;
                } else {
                    rowCheckerElm.disabled = false;
                }
            } catch (err) { }
        }
    </script>
    <asp:HiddenField ID="hd_err_txt" runat="server" />
    <div style="float: left; width: 98%; border: solid; border-color: gray; border-width: 1px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; text-align: right; padding: 5px 5px 5px 5px;">
        <div style="text-align: right; margin-top: 5px;">
            <div align="left" style="width: 600px; float: left">
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            </div>
            <div style="float: right;">
                &nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="Icons/delete.jpg" ToolTip="ลบข้อมูล" OnClientClick="popupwaitDelete()" />
                &nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="btnImportAll" runat="server" ImageUrl="Icons/Import.png" ToolTip="นำเข้าทั้งหมด" OnClientClick="popupwait()" />
                &nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="btnImportAdd" runat="server" ImageUrl="Icons/Import.png" ToolTip="นำเข้าเพิ่มเติม" OnClientClick="popupwait()" />
            </div>
        </div>
    </div>
    <div style="float: left; width: 98%">
        <center>
                  <div id="div1" runat="server" style=" width:98%; border: solid; border-color: gray; border-width: 1px; margin-right: 10px; margin-top: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; height: 150px;">
                <table border="0" style="width: 100%">
                    <tr>
                        <td colspan="2" align="left"><strong>นำเข้า สรุปงานโครงการและงานสนับสนุน</strong></td>
                        <td colspan="2" align="right"><strong>ปีงบประมาณ/Version</strong></td>
                    </tr>
                    <tr>
                        <td align="right" colspan="4">
                            <table border="0">
                                <tr>
                                    <td width="30px"></td>
                                    <td width="30px">ปี</td>
                                     <td width="70px">
                                         <asp:TextBox ID="PlanYearsTxt" runat="server" ReadOnly="false" Width="40px"></asp:TextBox></td>
                                     <td width="50px"> Version</td>
                                     <td width="70px">
                                         <asp:TextBox ID="txtVersion" runat="server" Width="40px"></asp:TextBox></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                         <td colspan="4" align="center">
                            <table>
                                <tr>
                                    <td width="30px"></td>
                                     <td width="50px"> ไฟล์</td>
                                     <td width="150px"><asp:FileUpload ID="FileUpload1" runat="server" Width="300px"   />
                                         </td>
                                    <td width="30px"></td>
                                </tr> 
                            </table>
                        </td>
                    </tr>
                   <tr><td colspan="4" align=center><asp:Button ID="Button1" runat="server"  Visible="false" Text="ดาวน์โหลดข้อมูลที่ผิดพลาด" /></td></tr>
                </table>
                </div> 
            <div id="loadingdiv" style="display:none;text-align:center;">
                     <img src="Images/loading.gif"/>
        <br /><p style="color:deeppink;font-size:20px;font-weight:bold">กรุณารอสักครู่</p>
                 </div>
<div style="text-align: right; float: left; width: 98%; border: solid; border-color: gray; border-width: 1px; margin-top: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; padding: 5px 5px 5px 5px;">
            <table id="t_countdata" runat="server" width="300" visible="false" border="0" style="float: left; margin-left: 13px;">
                <tr>
                    <td align="left" style="width: 80px;" valign="middle">
                        <asp:Label ID="L_data" runat="server" Text="ผลการค้นหา: "></asp:Label>
                    </td>
                    <td align="left">
                        <asp:Label ID="L_CountData" runat="server" ForeColor="red"></asp:Label>
                        <asp:Label ID="L_test" runat="server" CssClass="label" Visible="false"></asp:Label>
                        &nbsp;
                    </td>
                </tr>
            </table>
            <table style="float: right;">
                <tr>
                    <td>
                         <a href="#" title="เลือกหน่วยงานและกิจกรรมที่ต้องการ จากนั้นคลิกที่ปุ่มนี้เพื่อทำการค้นหา"><asp:ImageButton ID="btnSearch" runat="server" ImageUrl="Icons/search.jpg" /></a>
                &nbsp;&nbsp;
                        <asp:ImageButton ID="btnDel" runat="server" ImageUrl="Icons/delete.jpg" OnClientClick="CustomRequestDel(); return false" />
                        </td>
                </tr>
            </table>
        </div>
        <div style="float: left; width: 98%; border: solid; border-color: gray; border-width: 1px; margin-top: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; padding: 5px 5px 5px 5px;">
            <iswebgrid:webgrid id="WebGrid1" runat="server" usedefaultstyle="True" width="100%" defaultstylemode="Silver" height="330px"  oninitializepostback="WebGrid1_InitializePostBack" >
                <LayoutSettings AllowAddNew="No" EditOnClick="False" AllowColumnMove="No"
                    AllowEdit="No" AllowDelete="No" AllowSorting="Yes" ColumnFooters="No" NewRowLostFocusAction="AlwaysUpdate"
                    ResetNewRowValuesOnError="False" InProgressUIBehavior="ChangeCursorToHourGlass"
                    AlwaysShowHelpButton="false" PagingMode="ClassicPaging" PagingSize="10" ColumnFooterAggregateMode="CalculateAllData"
                    VirtualLoadMode="LargeData" AllowGrouping="Yes" VirtualPageSize="10" PagingLoadMode="Automatic" AllowExport="Yes">
                    <RowStyle Font-Names="Tahoma" Font-Size="9" CustomRules="overflow: hidden;" />
                    <AlternatingRowStyle Font-Names="Tahoma" Font-Size="9" BackColor="#fbfbfb" CustomRules="overflow: hidden;" />
                   <ClientSideEvents OnAfterResponseProcess="DisableCheck" />
                </LayoutSettings>
                <RootTable>
                    <Columns>
                        <ISWebGrid:WebGridColumn IsRowChecker="true" Name="checker"></ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="รหัสโครงการ/งานสนับสนุน" DataMember="Project_ProjectCode" Name="Project_ProjectCode" Width="150">
                            <HeaderStyle HorizontalAlign="Center" />
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="ชื่อย่อ (20 Digits)" DataMember="ShortDescription" Name="ShortDescription" Width="250">
                            <HeaderStyle HorizontalAlign="Center" />
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="ชื่อเต็ม (40 Digits)" DataMember="Description" Name="Description" Width="350">
                            <HeaderStyle HorizontalAlign="Center" />
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="Fund Center" DataMember="FundCenterCode" Name="FundCenterCode" Width="150">
                            <HeaderStyle HorizontalAlign="Center" />
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="จำนวนเงิน" DataMember="Amount" Name="Remark" Width="200">
                            <HeaderStyle HorizontalAlign="Center" />
                        </ISWebGrid:WebGridColumn>
                    </Columns>
                </RootTable>
            </iswebgrid:webgrid>
            
        </div>
            </center>
 
    </div>
    <asp:ScriptManager ID="Scriptmanager1" runat="server">
    </asp:ScriptManager>
    <%=AlertText%>
</asp:Content>


